﻿using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Security.Cryptography;
using System.Text;
using System.Windows.Media;
using Microsoft.Practices.Unity;

namespace CustomerAssistant
{
    public static class SysHelper
    {
        public static IUnityContainer UnityContainer = new UnityContainer();

        public static ImageSource GetImageSource(Image image, ImageFormat fmt)
        {
            MemoryStream memory = new MemoryStream();
            image.Save(memory, fmt);
            ImageSourceConverter imgCvt = new ImageSourceConverter();
            return (ImageSource)imgCvt.ConvertFrom(memory);
        }

        public static ImageSource GetImageSource(Icon image)
        {
            MemoryStream memory = new MemoryStream();
            image.Save(memory);
            ImageSourceConverter imgCvt = new ImageSourceConverter();
            return (ImageSource)imgCvt.ConvertFrom(memory);
        }
    }
}